<template>
  <div>
    <div class="header">
      <img src="../assets/images/fanhui.png" height="23" alt="" @click="back" />
      <div>商品订单</div>
    </div>

    <div class="search">
      <van-search show-action placeholder="关键字查询">
        <template #action>
          <div style="color: #1f3695">搜索</div>
        </template>
      </van-search>
    </div>
    <div class="box-con" v-for="item in records" :key="item.id">
      <div class="title">
        <span>快递单号:{{ item.orderCode }}</span
        ><img
          src="../assets/images/列表箭头.png"
          width="10"
          alt=""
          @click="back"
        />
      </div>
      <div class="box-con-b">
        <div class="lll">
          <img src="../assets/images/我的客户.png" width="60" alt="" />
        </div>
        <div class="rrr">
          <!-- <p>{{ records.title }}</p> -->
          <p>
            <span style="color: #989898">下单时间</span>
            {{ item.starTime }}
          </p>
          <p>
            <span style="color: #989898">收货人 <span style="color:#000">{{ item.consignee }}</span></span
            ><br />
            <span style="color: #989898">发货人 <span style="color:#000">{{ item.consignor }}</span></span>
          </p>
        </div>
      </div>
      <div class="box-footer">
        <div>
          <div v-show="item.star == 0" @click="btn1(item.id,item.orderCode)">评价</div>
          <div v-show="item.star == 1" @click="btn2(item.id)">查看评价</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { star } from "../request/api";
export default {
  methods: {
    back() {
      this.$router.back();
    },
    btn1(id,data){
      this.$router.push({path:'/pingjiagood/',query:{ id, data}})
    },
    btn2(id){
      this.$router.push("/good/"+id)
    }
  },
  data() {
    return {
      records: [],
    };
  },
  created() {
    star({
      keyword: "",
      current: "1",
      size: "5",
    }).then((res) => {
      if (res.errCode == 0) {
        // console.log(res.data.records);
        this.records = res.data.records;
      }
    });
  },
};
</script>
 
<style lang = "less" scoped>
* {
  padding: 0;
  margin: 0;
}

.header {
  width: 100vw;
  height: 64px;
  background: #003399;
  display: flex;
  color: #fff;
  font-size: 22px;
  padding: 25px 10px;
  box-sizing: border-box;
  img {
    margin-top: 3px;
    margin-right: 120px;
  }
}
.van-search__content {
  border-radius: 20px;
}
/deep/.van-tabs__line {
  background-color: #f2cb45;
}
.search {
  padding: 10px;
  box-sizing: border-box;
  background: #fff;
  border-bottom: 1px solid #e4e4e4;
}
.box-con {
  margin-top: 10px;
  background: #fff;
  .title {
    display: flex;
    justify-content: space-between;
    padding: 15px 10px;

    border-bottom: 1px solid #e4e4e4;
    box-sizing: border-box;
  }
  .box-con-b {
    width: 100vw;
    height: 104px;
    border-bottom: 1px dashed #e4e4e4;
    display: flex;
    .lll {
      padding: 15px 20px 28px;
      box-sizing: border-box;
    }
    .rrr {
      padding: 20px 0;
      box-sizing: border-box;
    }
  }
  .box-footer {
    width: 100vw;
    height: 55px;
    border-bottom: 1px solid #e4e4e4;
    padding: 13px 20px;
    box-sizing: border-box;
    div {
      float: right;
      width: 70px;
      height: 31px;
      text-align: center;
      line-height: 31px;
      background: #f1ca45;
      color: #fff;
      border-radius: 15px;
    }
  }
}
</style>